/*
 * 百度在线网络技术（北京）有限公司拥有本软件版权2021并保留所有权利。
 * Copyright 2021, Baidu.com,Inc 2:Baidu Online Network Technology (Beijing) Co.,Ltd,
 * All rights reserved.
 */

package com.azdebugit.spring.beantest.cnblog.spring.valu;

import org.springframework.beans.factory.annotation.Value;

public class Bottle {
    //使用字面量注入属性
    @Value(value = "red")
    private String color;

    //使用el表达式注入属性
    @Value(value = "#{30 / 3.14}")
    private double diameter;

    //使用占位符注入属性，需要在容器中引入配置文件
    @Value(value = "${bottle.source}")
    private String source;

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public double getDiameter() {
        return diameter;
    }

    public void setDiameter(double diameter) {
        this.diameter = diameter;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    @Override
    public String toString() {
        return "Bottle{" +
                "color='" + color + '\'' +
                ", diameter=" + diameter +
                ", source='" + source + '\'' +
                '}';
    }
}
